home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume15 / touchup / part06 < prev    next >
Encoding:
Text File  |  1988-06-14  |  62.3 KB  |  2,259 lines

  1. Newsgroups: comp.sources.unix
  2. Subject: v15i063:  A bitmap editor for Suns, Part06/06
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: Raymond T Kreisel <rayk@sbcs.sunysb.edu>
  6. Posting-number: Volume 15, Issue 63
  7. Archive-name: touchup/part06
  8.  
  9. THIS IS A COMPLETE REPOSTING OF THE ENTIRE PACKAGE.
  10.  
  11. #! /bin/sh
  12. # This is a shell archive.  Remove anything before this line, then unpack
  13. # it by saving it into a file and typing "sh file".  To overwrite existing
  14. # files, type "sh file -c".  You can also feed this as standard input via
  15. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  16. # will see the following message at the end:
  17. #        "End of archive 6 (of 6)."
  18. # Wrapped by rayk@sbcolor1 on Fri Apr  1 16:49:38 1988
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. if test -f info.c -a "${1}" != "-c" ; then 
  21.   echo shar: Will not over-write existing file \"info.c\"
  22. else
  23. echo shar: Extracting \"info.c\" \(6537 characters\)
  24. sed "s/^X//" >info.c <<'END_OF_info.c'
  25. X
  26. X/**************************************************************************
  27. X   Touchup a bitmap graphics editor for the Sun Workstation running SunView
  28. X   Copyright (c) 1988 by Raymond Kreisel
  29. X   1/22/88 @ Suny Stony Brook
  30. X
  31. X   This program may be redistributed without fee as long as this copyright
  32. X   notice is intact.
  33. X
  34. X==> PLEASE send comments and bug reports to one of the following addresses:
  35. X
  36. X       Ray Kreisel
  37. X       CS Dept., SUNY at Stony Brook, Stony Brook NY 11794
  38. X
  39. X       UUCP: {allegra, philabs, pyramid, research}!sbcs!rayk   
  40. X       ARPA-Internet: rayk@sbcs.sunysb.edu            
  41. X       CSnet: rayk@suny-sb
  42. X       (If nobody is home at any of the above addresses try:
  43. X        S72QKRE@TOWSONVX.BITNET                    )
  44. X
  45. X "If I get home before daylight, I just might get some sleep tonight...."
  46. X
  47. X**************************************************************************/
  48. X/**************************************************************************
  49. X    file: info.c
  50. X    purpose: this file has the functions that had the "view" pop up
  51. X        window.  You can view the "man page", copyright notice
  52. X        with the picture of the author (me), and the cut/paste
  53. X           buffer
  54. X
  55. X    modifications:
  56. X        date:    Tue Mar 22 22:04:58 EST 1988
  57. X        author:    rayk
  58. X        changes:add comments
  59. X**************************************************************************/
  60. X
  61. X#include "header.h"
  62. X
  63. X#include <suntool/textsw.h>
  64. X
  65. XFrame view_frame;
  66. XCanvas view_canvas;
  67. XPixwin *view_pw;
  68. XPanel view_panel;
  69. Xint view_flag=FALSE;
  70. X
  71. X
  72. X/*
  73. X * this function will read in the copyright notice
  74. X * with my picture on it and display it in a new window
  75. X */
  76. Xinfo_init()
  77. X{
  78. XFILE *fp,*fopen();
  79. Xint color_map=NULL;
  80. Xstruct pixrect *temp_pr;
  81. X
  82. X   fp = fopen(INFO_IMAGE,"r");
  83. X   if (!fp)
  84. X   {
  85. X      ERROR("I Could not find the information file !!!!");
  86. X      view_flag = FALSE;
  87. X      fclose(fp);
  88. X      return(0);
  89. X   }
  90. X   temp_pr = (struct pixrect *)pr_load(fp,color_map);
  91. X   if (!temp_pr)
  92. X   {
  93. X      ERROR("I Could not find the information file !!!!");
  94. X      view_flag = FALSE;
  95. X      fclose(fp);
  96. X      return(0);
  97. X   }
  98. X   view_init(temp_pr,"Information on Touchup");
  99. X   MY_pr_destroy(temp_pr);
  100. X   fclose(fp);
  101. X}
  102. X
  103. X
  104. X/*
  105. X * this function will let you view the cut/paste buffer
  106. X * in a seperate window
  107. X */
  108. Xview_cut_paste()
  109. X{
  110. X   if (cut_buffer_pr)
  111. X   {
  112. X     view_init(cut_buffer_pr,"The current Cut/Paste Buffer");
  113. X   }
  114. X   else
  115. X   {
  116. X     ERROR("The CUT/PASTE buffer is empty.");
  117. X   }
  118. X}
  119. X
  120. X
  121. X/*
  122. X * we got a button click on "view"
  123. X * check out what we need to view
  124. X */
  125. X#define VIEW_INFO 0
  126. X#define VIEW_HELP 1
  127. X#define VIEW_CUT_PASTE 2
  128. Xviewer()
  129. X{
  130. X   switch((int)panel_get_value(view_cycle)) {
  131. X    case VIEW_INFO: info_init();
  132. X             break;
  133. X    case VIEW_CUT_PASTE: view_cut_paste();
  134. X              break;
  135. X    case VIEW_HELP: view_help();
  136. X   }
  137. X}
  138. X
  139. X
  140. X/*
  141. X * close up the view window
  142. X */
  143. Xview_done()
  144. X{
  145. X   if (view_flag)
  146. X   {
  147. X     window_set(view_frame, FRAME_NO_CONFIRM, TRUE, 0);
  148. X     window_destroy(view_frame);
  149. X     view_flag = FALSE;  
  150. X   }
  151. X}
  152. X
  153. X
  154. X/*
  155. X * this function will take a pixrect and create a new window
  156. X * which we can view it in
  157. X */
  158. Xview_init(view_pr,frame_label)
  159. Xstruct pixrect *view_pr;
  160. Xchar *frame_label;
  161. X{
  162. XRect *r;
  163. X
  164. X   if (view_flag)
  165. X   {
  166. X      view_done();
  167. X   }
  168. X   view_flag = TRUE;
  169. X
  170. X    r = (Rect *) window_get(base_frame, WIN_RECT);
  171. X    view_frame = window_create(base_frame,FRAME,
  172. X        FRAME_LABEL,    frame_label,
  173. X            FRAME_SHOW_LABEL, TRUE,
  174. X        WIN_SHOW,    TRUE,
  175. X        WIN_FONT,    main_font,
  176. X        WIN_WIDTH,    view_pr->pr_size.x+20,
  177. X        WIN_HEIGHT,    view_pr->pr_size.y+60,
  178. X            WIN_X,        (r->r_width - view_pr->pr_size.x+20)/2,
  179. X            WIN_Y,        (r->r_height - view_pr->pr_size.y+50)/4,
  180. X        0);
  181. X
  182. X    view_canvas = 
  183. X        window_create(view_frame, CANVAS, 
  184. X        WIN_CONSUME_PICK_EVENTS,    WIN_NO_EVENTS,WIN_MOUSE_BUTTONS,
  185. X                    LOC_DRAG, LOC_WINENTER,
  186. X                    LOC_MOVE, 
  187. X                    0,
  188. X        WIN_X,        0,
  189. X        WIN_Y,        ATTR_ROW(2)+5,
  190. X        CANVAS_WIDTH,        view_pr->pr_size.x+5,
  191. X        CANVAS_HEIGHT,        view_pr->pr_size.y+5,
  192. X        CANVAS_AUTO_SHRINK,        TRUE,
  193. X        CANVAS_FIXED_IMAGE,        FALSE,
  194. X        CANVAS_AUTO_EXPAND,        TRUE,
  195. X        CANVAS_RETAINED,        TRUE,
  196. X        0),
  197. X
  198. X    view_pw = canvas_pixwin(view_canvas);
  199. X
  200. X    if (view_pr->pr_depth > 1)
  201. X    {
  202. X    pw_setcmsname(view_pw, "ray kreisel");
  203. X    pw_putcolormap(view_pw, 0,256,temp_red,temp_green,temp_blue);
  204. X    }
  205. X
  206. X    view_panel = window_create(view_frame, PANEL,
  207. X         PANEL_LABEL_BOLD,         TRUE,
  208. X        WIN_FONT,    main_font,
  209. X         WIN_X,             0,
  210. X         WIN_Y,             3,
  211. X         WIN_HEIGHT,         ATTR_ROW(1)+4,
  212. X        0);
  213. X   
  214. X   (void)panel_create_item(view_panel, PANEL_BUTTON, 
  215. X     PANEL_ITEM_X, ATTR_COL(0),
  216. X     PANEL_ITEM_Y, ATTR_ROW(0),
  217. X     PANEL_LABEL_IMAGE, panel_button_image(view_panel, "done", 5, (Pixfont *)0),
  218. X     PANEL_NOTIFY_PROC, view_done,
  219. X     0);
  220. X
  221. X  /* write the image files to the canvas */
  222. X
  223. X   pw_write(view_pw,0,0,view_pr->pr_size.x,
  224. X         view_pr->pr_size.y,PIX_SRC, view_pr,0,0);
  225. X}   
  226. X
  227. X
  228. X/*
  229. X * this function is used to view the man page
  230. X */
  231. X#define VIEW_HELP_FLAG 2
  232. Xview_help()
  233. X{
  234. XRect *r;
  235. X
  236. X   if (!file_exist(HELP_FILE))
  237. X   {
  238. X      ERROR("I cannot find the man page for touchup !!!");
  239. X      return(0);
  240. X   }
  241. X
  242. X   if (view_flag == VIEW_HELP_FLAG)
  243. X   {
  244. X      (void)window_set(view_frame, WIN_SHOW, TRUE, 0);
  245. X      return(0);
  246. X   }
  247. X   else
  248. X   {
  249. X      if (view_flag)
  250. X      view_done();
  251. X   }
  252. X   view_flag = VIEW_HELP_FLAG;
  253. X
  254. X    r = (Rect *) window_get(base_frame, WIN_RECT);
  255. X    view_frame = window_create(base_frame,FRAME,
  256. X        FRAME_LABEL,    "Help window",
  257. X            FRAME_SHOW_LABEL, TRUE,
  258. X        WIN_SHOW,    TRUE,
  259. X        WIN_FONT,    main_font,
  260. X            WIN_X,        (r->r_width - 600+20)/2,
  261. X            WIN_Y,        (r->r_height - 512+50)/4,
  262. X        0);
  263. X
  264. X    view_panel = window_create(view_frame, PANEL,
  265. X         PANEL_LABEL_BOLD,         TRUE,
  266. X        WIN_FONT,    main_font,
  267. X         WIN_X,             0,
  268. X         WIN_Y,             3,
  269. X         WIN_HEIGHT,         ATTR_ROW(1)+4,
  270. X        0);
  271. X   
  272. X   (void)panel_create_item(view_panel, PANEL_BUTTON, 
  273. X     PANEL_ITEM_X, ATTR_COL(0),
  274. X     PANEL_ITEM_Y, ATTR_ROW(0),
  275. X     PANEL_LABEL_IMAGE, panel_button_image(view_panel, "done", 5, (Pixfont *)0),
  276. X     PANEL_NOTIFY_PROC, view_done,
  277. X     0);
  278. X
  279. X
  280. X    (void)window_create(view_frame, TEXTSW,
  281. X        WIN_ERROR_MSG,         "I cannot find the man page for touchup",
  282. X                WIN_X,                  0,
  283. X        WIN_Y,            ATTR_ROW(2)+5,
  284. X                WIN_HEIGHT,             512,
  285. X                WIN_WIDTH,              600,
  286. X        TEXTSW_FONT,        main_font,
  287. X                TEXTSW_IGNORE_LIMIT,    TEXTSW_INFINITY,
  288. X                TEXTSW_AUTO_INDENT,     TRUE,
  289. X                TEXTSW_BROWSING,        TRUE,
  290. X                TEXTSW_DISABLE_LOAD,    TRUE,
  291. X                TEXTSW_DISABLE_CD,      TRUE,
  292. X            TEXTSW_FILE,        HELP_FILE,
  293. X                0);
  294. X
  295. X  window_fit(view_frame);
  296. X}   
  297. X
  298. X
  299. END_OF_info.c
  300. if test 6537 -ne `wc -c <info.c`; then
  301.     echo shar: \"info.c\" unpacked with wrong size!
  302. fi
  303. # end of overwriting check
  304. fi
  305. if test -f interface.c -a "${1}" != "-c" ; then 
  306.   echo shar: Will not over-write existing file \"interface.c\"
  307. else
  308. echo shar: Extracting \"interface.c\" \(20307 characters\)
  309. sed "s/^X//" >interface.c <<'END_OF_interface.c'
  310. X
  311. X/**************************************************************************
  312. X   Touchup a bitmap graphics editor for the Sun Workstation running SunView
  313. X   Copyright (c) 1988 by Raymond Kreisel
  314. X   1/22/88 @ Suny Stony Brook
  315. X
  316. X   This program may be redistributed without fee as long as this copyright
  317. X   notice is intact.
  318. X
  319. X==> PLEASE send comments and bug reports to one of the following addresses:
  320. X
  321. X       Ray Kreisel
  322. X       CS Dept., SUNY at Stony Brook, Stony Brook NY 11794
  323. X
  324. X       UUCP: {allegra, philabs, pyramid, research}!sbcs!rayk   
  325. X       ARPA-Internet: rayk@sbcs.sunysb.edu            
  326. X       CSnet: rayk@suny-sb
  327. X       (If nobody is home at any of the above addresses try:
  328. X        S72QKRE@TOWSONVX.BITNET                    )
  329. X
  330. X "If I get home before daylight, I just might get some sleep tonight...."
  331. X
  332. X**************************************************************************/
  333. X/**************************************************************************
  334. X    file: interface.c
  335. X    purpose: this file contains all of the window defs for touchup
  336. X
  337. X    modifications:
  338. X        date:    Tue Mar 22 22:04:58 EST 1988
  339. X        author:    rayk
  340. X        changes:add comments
  341. X**************************************************************************/
  342. X
  343. X#include"header.h"
  344. X
  345. X
  346. XCursor fat_cursor;
  347. X
  348. X
  349. Xstatic short icon_data[] = {
  350. X#include "touchup.icon"
  351. X};
  352. Xstatic mpr_static(touchup_pr, 64, 64, 1, icon_data);
  353. X
  354. Xstatic short cursor_data[] = {
  355. X#include "fat_cursor"
  356. X};
  357. Xstatic mpr_static(my_fat_cursor, 16, 16, 1, cursor_data);
  358. X
  359. X
  360. X
  361. X    Frame base_frame,fat_frame,color_frame,command_frame;
  362. X    Canvas canvas,fat_canvas,color_canvas;
  363. X    Pixwin *pw,*fat_pw,*color_pw;
  364. Xstatic Scrollbar    vertical_sb, horizontal_sb;
  365. X    Panel       panel,fat_panel,color_panel,pattern_panel,
  366. X        brush_panel,region_panel,command_panel;
  367. X    Panel_item magnify_cycle,grid_cycle,view_cycle;
  368. X    Panel_item  file_panel,brush_choice,mono_cycle,save_cycle,border_cycle,
  369. X        msg_string,color_button,text_panel,current_pattern,
  370. X        load_cycle,pattern_choice,command_choice,region_choice,
  371. X        compress_cycle,text_size_item,undo_button;
  372. X
  373. X   struct pixrect *pattern[PATTERN_NO];
  374. X   struct pixrect *brushes[BRUSH_NO];
  375. X  
  376. X
  377. X/*
  378. X * Build all of the window that we need for touchup
  379. X */
  380. Xinit_windows(argc,argv) int argc; char *argv[];
  381. X{
  382. X
  383. X    base_frame = window_create(NULL,FRAME,
  384. X        FRAME_ARGS,    argc,argv,
  385. X        FRAME_LABEL,    "TouchUp version 2.2",
  386. X        FRAME_ICON,        icon_create(ICON_IMAGE, &touchup_pr, 0),
  387. X        FRAME_INHERIT_COLORS,  TRUE,
  388. X        WIN_FONT,    main_font,
  389. X        WIN_WIDTH,    1030,
  390. X        WIN_HEIGHT,    675+ATTR_ROW(10),
  391. X        WIN_X,        10,
  392. X        WIN_Y,        10,
  393. X        0);
  394. X    panel = window_create(base_frame, PANEL,
  395. X         PANEL_LABEL_BOLD,         TRUE,
  396. X         WIN_FONT,              main_font,
  397. X         WIN_X,             0,
  398. X         WIN_Y,             3,
  399. X         WIN_HEIGHT,         ATTR_ROW(5),
  400. X        0);
  401. X
  402. X
  403. X
  404. X    vertical_sb = scrollbar_create((char*)0);
  405. X    horizontal_sb = scrollbar_create((char*)0);
  406. X
  407. X    canvas = 
  408. X        window_create(base_frame, CANVAS, 
  409. X        WIN_VERTICAL_SCROLLBAR,    vertical_sb,
  410. X        WIN_HORIZONTAL_SCROLLBAR,    horizontal_sb,
  411. X        WIN_CONSUME_PICK_EVENTS,    WIN_NO_EVENTS,WIN_MOUSE_BUTTONS,
  412. X                    LOC_DRAG,
  413. X                    LOC_MOVE, 
  414. X                    0,
  415. X        WIN_EVENT_PROC,         handle_event,
  416. X        WIN_WIDTH,            780,
  417. X/*        WIN_HEIGHT,             650, */
  418. X        WIN_X,            PATTERN_SIZE*2+70,
  419. X        WIN_Y,            ATTR_ROW(7)+12,
  420. X        CANVAS_AUTO_SHRINK,        FALSE,
  421. X        CANVAS_AUTO_EXPAND,        FALSE,
  422. X        CANVAS_FIXED_IMAGE,        FALSE,
  423. X        CANVAS_RETAINED,        TRUE,
  424. X        CANVAS_WIDTH,        image_wid,
  425. X        CANVAS_HEIGHT,        image_hgt,
  426. X        WIN_BELOW,            panel,
  427. X        0),
  428. X
  429. X
  430. X    pw = canvas_pixwin(canvas);
  431. X
  432. X
  433. X    command_panel = window_create(base_frame, PANEL,
  434. X         WIN_FONT,            main_font,
  435. X/*         WIN_X,             1000-(COMMAND_SIZE*2+32), */
  436. X         WIN_Y,             ATTR_ROW(6)+12,
  437. X         WIN_WIDTH,             COMMAND_SIZE*2+5,
  438. X         WIN_HEIGHT,         COMMAND_SIZE*COMMAND_NO/2+9,
  439. X         WIN_RIGHT_OF,         canvas,
  440. X         WIN_BELOW,             panel,
  441. X        0);
  442. X
  443. X   command_choice = panel_create_item(command_panel, PANEL_CHOICE, 
  444. X         PANEL_LABEL_BOLD,         TRUE,
  445. X         PANEL_SHOW_MENU,         FALSE,
  446. X         PANEL_LAYOUT,        PANEL_VERTICAL,
  447. X         PANEL_VALUE,         6,
  448. X         PANEL_LABEL_X,        10,
  449. X         PANEL_LABEL_Y,        4,
  450. X         PANEL_DISPLAY_LEVEL,    PANEL_ALL,
  451. X         PANEL_FEEDBACK,        PANEL_INVERTED,
  452. X         PANEL_CHOICE_IMAGES,    &command12_pr,&command5_pr,
  453. X                    &command13_pr,&command14_pr,
  454. X                    &command1_pr,&command6_pr,
  455. X                    &command15_pr,&command3_pr,
  456. X                    &command4_pr,&command16_pr,
  457. X                    &command11_pr,&command10_pr,
  458. X                    &command2_pr,&command7_pr,
  459. X                    &command9_pr,&command8_pr,
  460. X                    0,
  461. X         PANEL_CHOICE_XS,        1,51,1,51,1,51,
  462. X                    1,51,1,51,1,51,
  463. X                    1,51,1,51,
  464. X                    0,
  465. X         
  466. X         PANEL_CHOICE_YS,        1,1,
  467. X                    50,50,
  468. X                    99,99,
  469. X                    148,148,
  470. X                    197,197,
  471. X                    246,246,
  472. X                    295,295,
  473. X                    344,344,
  474. X                    0,
  475. X         PANEL_NOTIFY_PROC,     command_handle,
  476. X         0);
  477. X
  478. X
  479. X    brush_panel = window_create(base_frame, PANEL,
  480. X         WIN_FONT,            main_font,
  481. X         WIN_SHOW,            TRUE,
  482. X         WIN_X,             1000-(COMMAND_SIZE*2+32),
  483. X         WIN_Y,             COMMAND_SIZE*COMMAND_NO/2+9+ATTR_ROW(6)+14,
  484. X         WIN_WIDTH,             COMMAND_SIZE*2+5,
  485. X/*         WIN_HEIGHT,         COMMAND_SIZE*4+15, */
  486. X         WIN_BELOW,             command_panel,
  487. X         WIN_RIGHT_OF,         canvas,
  488. X        0);
  489. X
  490. X   brush_choice = panel_create_item(brush_panel, PANEL_CHOICE, 
  491. X         PANEL_LABEL_BOLD,         TRUE,
  492. X         PANEL_SHOW_MENU,         FALSE,
  493. X         PANEL_LAYOUT,        PANEL_VERTICAL,
  494. X         PANEL_VALUE,         3,
  495. X         PANEL_LABEL_X,        10,
  496. X         PANEL_LABEL_Y,        4,
  497. X         PANEL_DISPLAY_LEVEL,    PANEL_ALL,
  498. X         PANEL_FEEDBACK,        PANEL_MARKED,
  499. X         PANEL_CHOICE_IMAGES,    &brush1_pr,&brush2_pr,
  500. X                    &brush3_pr,&brush4_pr,
  501. X                    &brush5_pr,&brush6_pr,
  502. X                    0,
  503. X         PANEL_CHOICE_XS,        51,51,51,51,51,51,
  504. X                    0,
  505. X         
  506. X         PANEL_CHOICE_YS,        1,
  507. X                    35,69,
  508. X                    103,137,
  509. X                    171,
  510. X                    0,
  511. X         PANEL_MARK_XS,        3,
  512. X                    0,
  513. X         
  514. X         PANEL_MARK_YS,        1,
  515. X                    35,69,
  516. X                    103,137,
  517. X                    171,
  518. X                    0,
  519. X         0);
  520. X
  521. X  brushes[0] = &brush1_pr;
  522. X  brushes[1] = &brush2_pr;
  523. X  brushes[2] = &brush3_pr;
  524. X  brushes[3] = &brush4_pr;
  525. X  brushes[4] = &brush5_pr;
  526. X  brushes[5] = &brush6_pr;
  527. X
  528. X
  529. X
  530. X
  531. X    region_panel = window_create(base_frame, PANEL,
  532. X         WIN_FONT,            main_font,
  533. X         WIN_SHOW,            FALSE,
  534. X         WIN_X,             1000-(COMMAND_SIZE*2+32),
  535. X         WIN_Y,             COMMAND_SIZE*COMMAND_NO/2+9+ATTR_ROW(6)+14,
  536. X         WIN_WIDTH,             COMMAND_SIZE*2+5,
  537. X/*         WIN_HEIGHT,         COMMAND_SIZE*4+4, */
  538. X         WIN_BELOW,             command_panel,
  539. X         WIN_RIGHT_OF,         canvas,
  540. X        0);
  541. X
  542. X   region_choice = panel_create_item(region_panel, PANEL_CHOICE, 
  543. X         PANEL_LABEL_BOLD,         TRUE,
  544. X         PANEL_SHOW_MENU,         FALSE,
  545. X         PANEL_LAYOUT,        PANEL_VERTICAL,
  546. X         PANEL_VALUE,         5,
  547. X         PANEL_LABEL_X,        10,
  548. X         PANEL_LABEL_Y,        4,
  549. X         PANEL_DISPLAY_LEVEL,    PANEL_ALL,
  550. X         PANEL_FEEDBACK,        PANEL_INVERTED,
  551. X         PANEL_CHOICE_IMAGES,    ®_command2_pr,®_command3_pr,
  552. X                    ®_command4_pr,®_command7_pr,
  553. X                    ®_command5_pr,®_command6_pr,
  554. X                    ®_command8_pr,®_command1_pr,
  555. X                    0,
  556. X         PANEL_CHOICE_XS,        1,51,1,51,1,51,1,51,
  557. X                    0,
  558. X         
  559. X         PANEL_CHOICE_YS,        1,1,
  560. X                    50,50,
  561. X                    99,99,
  562. X                    148,148,
  563. X                    0,
  564. X         PANEL_NOTIFY_PROC,     region_handle,
  565. X         0);
  566. X
  567. X
  568. X    pattern_panel = window_create(base_frame, PANEL,
  569. X         WIN_FONT,            main_font,
  570. X         WIN_X,             0,
  571. X         WIN_Y,            ATTR_ROW(6)+12,
  572. X          WIN_BELOW,            panel,
  573. X         WIN_WIDTH,             PATTERN_SIZE*2+65,
  574. X/*         WIN_HEIGHT,         PATTERN_SIZE*PATTERN_NO/2+22, */
  575. X        0);
  576. X
  577. X   (void)panel_create_item(pattern_panel, PANEL_BUTTON, 
  578. X     PANEL_ITEM_X, ATTR_COL(0),
  579. X     PANEL_ITEM_Y, PATTERN_SIZE*PATTERN_NO/2+40,
  580. X     PANEL_LABEL_IMAGE, panel_button_image(panel, "define pattern", 14, (Pixfont *)0),
  581. X     PANEL_NOTIFY_PROC, pattern_define,
  582. X     0);
  583. X
  584. X   pattern_choice = panel_create_item(pattern_panel, PANEL_CHOICE, 
  585. X         PANEL_LABEL_BOLD,         TRUE,
  586. X         PANEL_SHOW_MENU,         FALSE,
  587. X         PANEL_LAYOUT,        PANEL_VERTICAL,
  588. X         PANEL_LABEL_X,        10,
  589. X         PANEL_LABEL_Y,        4,
  590. X         PANEL_VALUE,         0,
  591. X         PANEL_DISPLAY_LEVEL,    PANEL_ALL,
  592. X         PANEL_FEEDBACK,        PANEL_MARKED,
  593. X         PANEL_NOTIFY_PROC,     select_pattern,
  594. X         PANEL_CHOICE_IMAGES,    &pattern1_pr,&pattern2_pr,&pattern3_pr,
  595. X                    &pattern4_pr,&pattern5_pr,
  596. X                    &pattern6_pr,&pattern7_pr,
  597. X                    &pattern8_pr,&pattern9_pr,
  598. X                    &pattern10_pr,
  599. X                         &pattern11_pr,&pattern12_pr,&pattern13_pr,
  600. X                    &pattern14_pr,&pattern15_pr,
  601. X                    &pattern16_pr,&pattern17_pr,
  602. X                    &pattern18_pr,&pattern19_pr,
  603. X                    &pattern20_pr,
  604. X                         &pattern21_pr,&pattern22_pr,&pattern23_pr,
  605. X                    &pattern24_pr,&pattern25_pr,
  606. X                    &pattern26_pr,&pattern27_pr,
  607. X                    &pattern28_pr,&pattern29_pr,
  608. X                    &pattern30_pr,
  609. X                         &pattern31_pr,&pattern32_pr,&pattern33_pr,
  610. X                    &pattern34_pr,&pattern35_pr,
  611. X                    &pattern36_pr,&pattern37_pr,
  612. X                    &pattern38_pr,&pattern39_pr,
  613. X                    &pattern40_pr,0,
  614. X         PANEL_CHOICE_XS,        25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,0,
  615. X         
  616. X         PANEL_CHOICE_YS,        1+35,33+35,65+35,97+35,129+35,161+35,193+35,225+35,257+35,289+35,
  617. X                    321+35,353+35,385+35,417+35,449+35,481+35,513+35,545+35,577+35,609+35,
  618. X                         1+35,33+35,65+35,97+35,129+35,161+35,193+35,225+35,257+35,289+35,
  619. X                    321+35,353+35,385+35,417+35,449+35,481+35,513+35,545+35,577+35,609+35,0,
  620. X         PANEL_MARK_XS,        3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,0,
  621. X         PANEL_MARK_YS,        8+35,40+35,72+35,104+35,136+35,168+35,200+35,232+35,266+35,296+35,
  622. X                    328+35,360+35,392+35,426+35,456+35,488+35,520+35,552+35,584+35,616+35,
  623. X                         8+35,40+35,72+35,104+35,136+35,168+35,200+35,232+35,266+35,296+35,
  624. X                    328+35,360+35,392+35,426+35,456+35,488+35,520+35,552+35,584+35,616+35,0,
  625. X
  626. X     0);
  627. X
  628. X  pattern[0] = &pattern1_pr;
  629. X  pattern[1] = &pattern2_pr;
  630. X  pattern[2] = &pattern3_pr;
  631. X  pattern[3] = &pattern4_pr;
  632. X  pattern[4] = &pattern5_pr;
  633. X  pattern[5] = &pattern6_pr;
  634. X  pattern[6] = &pattern7_pr;
  635. X  pattern[7] = &pattern8_pr;
  636. X  pattern[8] = &pattern9_pr;
  637. X  pattern[9] = &pattern10_pr;
  638. X  pattern[10] = &pattern11_pr;
  639. X  pattern[11] = &pattern12_pr;
  640. X  pattern[12] = &pattern13_pr;
  641. X  pattern[13] = &pattern14_pr;
  642. X  pattern[14] = &pattern15_pr;
  643. X  pattern[15] = &pattern16_pr;
  644. X  pattern[16] = &pattern17_pr;
  645. X  pattern[17] = &pattern18_pr;
  646. X  pattern[18] = &pattern19_pr;
  647. X  pattern[19] = &pattern20_pr;
  648. X  pattern[20] = &pattern21_pr;
  649. X  pattern[21] = &pattern22_pr;
  650. X  pattern[22] = &pattern23_pr;
  651. X  pattern[23] = &pattern24_pr;
  652. X  pattern[24] = &pattern25_pr;
  653. X  pattern[25] = &pattern26_pr;
  654. X  pattern[26] = &pattern27_pr;
  655. X  pattern[27] = &pattern28_pr;
  656. X  pattern[28] = &pattern29_pr;
  657. X  pattern[29] = &pattern30_pr;
  658. X  pattern[30] = &pattern31_pr;
  659. X  pattern[31] = &pattern32_pr;
  660. X  pattern[32] = &pattern33_pr;
  661. X  pattern[33] = &pattern34_pr;
  662. X  pattern[34] = &pattern35_pr;
  663. X  pattern[35] = &pattern36_pr;
  664. X  pattern[36] = &pattern37_pr;
  665. X  pattern[37] = &pattern38_pr;
  666. X  pattern[38] = &pattern39_pr;
  667. X  pattern[39] = &pattern40_pr;
  668. X
  669. X   current_pattern = panel_create_item(pattern_panel, PANEL_MESSAGE, 
  670. X     PANEL_ITEM_X, ATTR_COL(6),
  671. X     PANEL_ITEM_Y, 3,
  672. X     PANEL_LABEL_IMAGE, &pattern1_pr,
  673. X     0);
  674. X
  675. X    color_frame = window_create(base_frame,FRAME,
  676. X        FRAME_LABEL,    "Color Pallet",
  677. X            FRAME_SHOW_LABEL, TRUE,
  678. X        WIN_FONT,    main_font,
  679. X        WIN_WIDTH,    PALET_BLOCK*16+9,
  680. X        WIN_HEIGHT,    PALET_BLOCK*(16+3)+20+ATTR_ROW(2),
  681. X        WIN_X,        650,
  682. X        WIN_Y,        10,
  683. X        0);
  684. X
  685. X    color_canvas = 
  686. X        window_create(color_frame, CANVAS, 
  687. X        WIN_CONSUME_PICK_EVENTS,    WIN_NO_EVENTS, WIN_MOUSE_BUTTONS,
  688. X                    LOC_DRAG,
  689. X                    LOC_MOVE, 
  690. X                    0,
  691. X        WIN_EVENT_PROC,         color_handle_event,
  692. X        WIN_X,        0,
  693. X        WIN_Y,        ATTR_ROW(2)+5,
  694. X        CANVAS_WIDTH,        PALET_BLOCK*16,
  695. X        CANVAS_HEIGHT,        PALET_BLOCK*(16+3),
  696. X        CANVAS_AUTO_SHRINK,        FALSE,
  697. X        CANVAS_FIXED_IMAGE,        FALSE,
  698. X        CANVAS_AUTO_EXPAND,        TRUE,
  699. X        CANVAS_REPAINT_PROC,    draw_colormap,
  700. X        CANVAS_RESIZE_PROC,        draw_colormap,
  701. X        0),
  702. X
  703. X    color_pw = canvas_pixwin(color_canvas);
  704. X
  705. X    color_panel = window_create(color_frame, PANEL,
  706. X         PANEL_LABEL_BOLD,         TRUE,
  707. X        WIN_FONT,    main_font,
  708. X         WIN_X,             0,
  709. X         WIN_Y,             3,
  710. X         WIN_WIDTH,             PALET_BLOCK*16+1,
  711. X         WIN_HEIGHT,         ATTR_ROW(1)+4,
  712. X        0);
  713. X
  714. X
  715. X   (void)panel_create_item(color_panel, PANEL_BUTTON, 
  716. X     PANEL_ITEM_X, ATTR_COL(0),
  717. X     PANEL_ITEM_Y, ATTR_ROW(0),
  718. X     PANEL_LABEL_IMAGE, panel_button_image(color_panel, "done", 5, (Pixfont *)0),
  719. X     PANEL_NOTIFY_PROC, color_done,
  720. X     0);
  721. X
  722. X
  723. X
  724. X   
  725. X    fat_frame = window_create(base_frame,FRAME,
  726. X        FRAME_LABEL,    "Big bits",
  727. X            FRAME_SHOW_LABEL, TRUE,
  728. X        WIN_CURSOR,    cursor_create(CURSOR_IMAGE, &my_fat_cursor,0),
  729. X        WIN_FONT,    main_font,
  730. X        WIN_WIDTH,    ATTR_COL(31),
  731. X        WIN_HEIGHT,    ATTR_ROW(24),
  732. X         WIN_X,             0,
  733. X         WIN_Y,            ATTR_ROW(8)+12,
  734. X        0);
  735. X
  736. X    fat_canvas = 
  737. X        window_create(fat_frame, CANVAS, 
  738. X        WIN_CONSUME_PICK_EVENTS,    WIN_NO_EVENTS,WIN_MOUSE_BUTTONS,
  739. X                    LOC_DRAG,
  740. X                    LOC_MOVE, 
  741. X                    0,
  742. X        WIN_CURSOR,            cursor_create(CURSOR_IMAGE, &my_fat_cursor,0),
  743. X        WIN_EVENT_PROC,         fat_handle_event,
  744. X        WIN_X,        0,
  745. X        WIN_Y,        ATTR_ROW(2)+5,
  746. X        CANVAS_WIDTH,        ATTR_COL(30),
  747. X        CANVAS_HEIGHT,        ATTR_ROW(14),
  748. X        CANVAS_AUTO_SHRINK,        TRUE,
  749. X        CANVAS_FIXED_IMAGE,        FALSE,
  750. X        CANVAS_AUTO_EXPAND,        TRUE,
  751. X        CANVAS_RETAINED,        TRUE,
  752. X        0),
  753. X
  754. X    fat_pw = canvas_pixwin(fat_canvas);
  755. X
  756. X    fat_panel = window_create(fat_frame, PANEL,
  757. X         PANEL_LABEL_BOLD,         TRUE,
  758. X        WIN_FONT,    main_font,
  759. X         WIN_X,             0,
  760. X         WIN_Y,             3,
  761. X         WIN_WIDTH,             ATTR_COL(30),
  762. X         WIN_HEIGHT,         ATTR_ROW(1)+4,
  763. X        0);
  764. X   
  765. X    magnify_cycle = 
  766. X    panel_create_item(fat_panel, PANEL_CYCLE,
  767. X        PANEL_ITEM_X, ATTR_COL(8),
  768. X        PANEL_ITEM_Y, ATTR_ROW(0),
  769. X        PANEL_LABEL_STRING, "Magnification:",
  770. X        PANEL_CHOICE_STRINGS, "1x", "2x","3x","4x",
  771. X                  "5x","6x","7x","8x","9x",
  772. X                  "10x","11x","12x","13x","14x",
  773. X                  "15x","16x","17x","18x","19x",
  774. X                  "20x", 0,
  775. X        PANEL_VALUE, 8,
  776. X        PANEL_NOTIFY_PROC, fat_parms,
  777. X        0);
  778. X
  779. X   (void)panel_create_item(fat_panel, PANEL_BUTTON, 
  780. X     PANEL_ITEM_X, ATTR_COL(0),
  781. X     PANEL_ITEM_Y, ATTR_ROW(0),
  782. X     PANEL_LABEL_IMAGE, panel_button_image(fat_panel, "done", 5, (Pixfont *)0),
  783. X     PANEL_NOTIFY_PROC, fat_done,
  784. X     0);
  785. X
  786. X
  787. X   (void)panel_create_item(panel, PANEL_BUTTON, 
  788. X     PANEL_ITEM_X, ATTR_COL(8),
  789. X     PANEL_ITEM_Y, ATTR_ROW(1),
  790. X     PANEL_LABEL_IMAGE, panel_button_image(panel, "view", 5, (Pixfont *)0),
  791. X     PANEL_NOTIFY_PROC, viewer,
  792. X     0);
  793. X
  794. X    view_cycle =
  795. X    panel_create_item(panel, PANEL_CYCLE,
  796. X        PANEL_ITEM_X, ATTR_COL(16),
  797. X        PANEL_ITEM_Y, ATTR_ROW(1),
  798. X        PANEL_LABEL_STRING, "View:",
  799. X        PANEL_CHOICE_STRINGS, "Touchup info", "man page (help)", "Cut/Paste buffer", 0,
  800. X        PANEL_VALUE, 1,
  801. X        0);
  802. X
  803. X   (void)panel_create_item(panel, PANEL_BUTTON, 
  804. X     PANEL_ITEM_X, ATTR_COL(8),
  805. X     PANEL_ITEM_Y, ATTR_ROW(0),
  806. X     PANEL_LABEL_IMAGE, panel_button_image(panel, "load", 5, (Pixfont *)0),
  807. X     PANEL_NOTIFY_PROC, load_file,
  808. X     0);
  809. X    load_cycle =
  810. X    panel_create_item(panel, PANEL_CYCLE,
  811. X        PANEL_ITEM_X, ATTR_COL(16),
  812. X        PANEL_ITEM_Y, ATTR_ROW(0),
  813. X        PANEL_LABEL_STRING, "Load:",
  814. X        PANEL_CHOICE_STRINGS, "entire image", "Cut/Paste buffer", 0,
  815. X        PANEL_VALUE, LOAD_ALL,
  816. X        0);
  817. X
  818. X   (void)panel_create_item(panel, PANEL_BUTTON, 
  819. X     PANEL_ITEM_X, ATTR_COL(45),
  820. X     PANEL_ITEM_Y, ATTR_ROW(0),
  821. X     PANEL_LABEL_IMAGE, panel_button_image(panel, "save", 5, (Pixfont *)0),
  822. X     PANEL_NOTIFY_PROC, save_file,
  823. X     0);
  824. X
  825. X    save_cycle =
  826. X    panel_create_item(panel, PANEL_CYCLE,
  827. X        PANEL_ITEM_X, ATTR_COL(53),
  828. X        PANEL_ITEM_Y, ATTR_ROW(0),
  829. X        PANEL_LABEL_STRING, "Save:",
  830. X        PANEL_CHOICE_STRINGS, "entire image", "Cut/Paste buffer", 0,
  831. X        PANEL_VALUE, SAVE_ALL,
  832. X        0);
  833. X
  834. X    compress_cycle =
  835. X    panel_create_item(panel, PANEL_CYCLE,
  836. X        PANEL_ITEM_X, ATTR_COL(53),
  837. X        PANEL_ITEM_Y, ATTR_ROW(1),
  838. X        PANEL_LABEL_STRING, "Save:",
  839. X        PANEL_CHOICE_STRINGS, "Standard format","Compressed",0,
  840. X        PANEL_VALUE, 0,
  841. X        0);
  842. X
  843. X   (void)panel_create_item(panel, PANEL_BUTTON, 
  844. X     PANEL_ITEM_X, ATTR_COL(0),
  845. X     PANEL_ITEM_Y, ATTR_ROW(0),
  846. X     PANEL_LABEL_IMAGE, panel_button_image(panel, "quit", 5, (Pixfont *)0),
  847. X     PANEL_NOTIFY_PROC, quit,
  848. X     0);
  849. X
  850. X   undo_button = panel_create_item(panel, PANEL_BUTTON, 
  851. X     PANEL_ITEM_X, ATTR_COL(0),
  852. X     PANEL_ITEM_Y, ATTR_ROW(2),
  853. X     PANEL_LABEL_IMAGE, panel_button_image(panel, "undo", 5, (Pixfont *)0),
  854. X     PANEL_NOTIFY_PROC, undo_screen,
  855. X     0);
  856. X
  857. X    grid_cycle =
  858. X    panel_create_item(panel, PANEL_CYCLE,
  859. X        PANEL_ITEM_X, ATTR_COL(8),
  860. X        PANEL_ITEM_Y, ATTR_ROW(2),
  861. X        PANEL_LABEL_STRING, "Grid size:",
  862. X        PANEL_CHOICE_STRINGS, "none","5","10","15","20","25","30",0,
  863. X        PANEL_VALUE, grid_size,
  864. X        PANEL_NOTIFY_PROC, change_parms,
  865. X        0);
  866. X
  867. X    border_cycle =
  868. X    panel_create_item(panel, PANEL_CYCLE,
  869. X        PANEL_ITEM_X, ATTR_COL(30),
  870. X        PANEL_ITEM_Y, ATTR_ROW(2),
  871. X        PANEL_LABEL_STRING, "Borders:",
  872. X        PANEL_CHOICE_STRINGS, "No","Yes",0,
  873. X        PANEL_VALUE, 1,
  874. X        0);
  875. X
  876. X   file_panel=panel_create_item(panel, PANEL_TEXT, 
  877. X     PANEL_ITEM_X, ATTR_COL(80),
  878. X     PANEL_ITEM_Y, ATTR_ROW(0),
  879. X     PANEL_VALUE, file_name,
  880. X     PANEL_VALUE_DISPLAY_LENGTH, 35,
  881. X     PANEL_LABEL_STRING, "Filename:",
  882. X     PANEL_NOTIFY_PROC, make_new_name,
  883. X     PANEL_NOTIFY_STRING, "\033",
  884. X     PANEL_VALUE_STORED_LENGTH, MAX_FILE_NAME,
  885. X     PANEL_SHOW_MENU, FALSE,
  886. X     0);
  887. X
  888. X   text_panel=panel_create_item(panel, PANEL_TEXT, 
  889. X     PANEL_ITEM_X, ATTR_COL(80),
  890. X     PANEL_ITEM_Y, ATTR_ROW(1),
  891. X     PANEL_VALUE, "",
  892. X     PANEL_VALUE_DISPLAY_LENGTH, 32,
  893. X     PANEL_LABEL_STRING, "Text string:",
  894. X     PANEL_VALUE_STORED_LENGTH, MAX_FILE_NAME,
  895. X     PANEL_SHOW_MENU, FALSE,
  896. X     0);
  897. X
  898. X
  899. X        text_size_item = panel_create_item(panel,PANEL_CYCLE,
  900. X                                          PANEL_ITEM_X, ATTR_COL(80),
  901. X                                          PANEL_ITEM_Y, ATTR_ROW(2),
  902. X                      PANEL_LABEL_STRING, "Fonts:",
  903. X                                          PANEL_CHOICE_STRINGS, "ABC abc 123",
  904. X                                "ABC abc 123",
  905. X                                "ABC abc 123",
  906. X                                "ABC abc 123",
  907. X                                "ABC abc 123",
  908. X                                "ABC abc 123",
  909. X                                "ABC abc 123",
  910. X                                "ABC abc 123",
  911. X                                "ABC abc 123",
  912. X                                "ABC abc 123",
  913. X                                "ABC abc 123",
  914. X                                "ABC abc 123",
  915. X                                "ABC abc 123",
  916. X                                "ABC abc 123",
  917. X                                "ABC abc 123",
  918. X                                "ABC abc 123",
  919. X                                "ABC abc 123",
  920. X                                "ABC abc 123",
  921. X                                "ABC abc 123",
  922. X                                                                0,
  923. X                                          PANEL_CHOICE_FONTS, 
  924. X                                                       cour_r_10,
  925. X                                                              cour_r_12,
  926. X                                                              cour_r_16,
  927. X                                                              cour_r_24,
  928. X                                  cour_b_10,
  929. X                                                              cour_b_12,
  930. X                                                              cour_b_16,
  931. X                                                              cour_b_24,
  932. X                                                              serif_r_10,
  933. X                                                              serif_r_11,
  934. X                                                              serif_r_16,
  935. X                                  screen_r_7,
  936. X                                  screen_r_11,
  937. X                                  screen_r_12,
  938. X                                  screen_r_14,
  939. X                                  screen_b_12,
  940. X                                  screen_b_14,
  941. X                                  pcfont_b_14,
  942. X                                  pcfont_r_14,
  943. X                                                              0,
  944. X                                          0);
  945. X
  946. X
  947. X    mono_cycle =
  948. X    panel_create_item(panel, PANEL_CYCLE,
  949. X        PANEL_ITEM_X, ATTR_COL(48),
  950. X        PANEL_ITEM_Y, ATTR_ROW(2),
  951. X        PANEL_LABEL_STRING, "Draw color",
  952. X        PANEL_CHOICE_STRINGS, "WHITE", "BLACK",
  953. X                   0,
  954. X        PANEL_VALUE, 1,
  955. X        PANEL_NOTIFY_PROC, change_parms,
  956. X        0);
  957. X
  958. X   color_button = panel_create_item(panel, PANEL_BUTTON, 
  959. X     PANEL_ITEM_X, ATTR_COL(52),
  960. X     PANEL_ITEM_Y, ATTR_ROW(2),
  961. X     PANEL_SHOW_ITEM, FALSE,
  962. X     PANEL_LABEL_IMAGE, panel_button_image(panel, "color", 5, (Pixfont *)0),
  963. X     PANEL_NOTIFY_PROC, color_mode,
  964. X     0);
  965. X
  966. X   msg_string = panel_create_item(panel, PANEL_MESSAGE, 
  967. X     PANEL_ITEM_X, ATTR_COL(0),
  968. X     PANEL_ITEM_Y, ATTR_ROW(4),
  969. X     PANEL_LABEL_BOLD,    TRUE,
  970. X     PANEL_LABEL_STRING, "",
  971. X     0);
  972. X
  973. X  fat_cursor = window_get(canvas,WIN_CURSOR);
  974. X  cursor_set(fat_cursor,CURSOR_OP,PIX_SRC^PIX_DST,0);
  975. X  window_set(canvas,WIN_CURSOR,fat_cursor,0);
  976. X
  977. X  fat_cursor = window_get(fat_canvas,WIN_CURSOR);
  978. X  cursor_set(fat_cursor,CURSOR_OP,PIX_SRC^PIX_DST,0);
  979. X  window_set(fat_canvas,WIN_CURSOR,fat_cursor,0);
  980. X
  981. X}
  982. X
  983. END_OF_interface.c
  984. if test 20307 -ne `wc -c <interface.c`; then
  985.     echo shar: \"interface.c\" unpacked with wrong size!
  986. fi
  987. # end of overwriting check
  988. fi
  989. if test -f magnify.c -a "${1}" != "-c" ; then 
  990.   echo shar: Will not over-write existing file \"magnify.c\"
  991. else
  992. echo shar: Extracting \"magnify.c\" \(1789 characters\)
  993. sed "s/^X//" >magnify.c <<'END_OF_magnify.c'
  994. X#include "header.h"
  995. X
  996. X/*
  997. X *  Magnifying glass        (for Sun-3 workstations)
  998. X *
  999. X *  Copyright 1986, 1987 by Scott Schwartz
  1000. X *  This program may be copied with the provision that this copyright 
  1001. X *  message remains, and that further distribution of this code and it's 
  1002. X *  derivatives is not subject to additional restrictions.
  1003. X * 
  1004. X *  Lots of changes, but no Copyright, by Mark Weiser.
  1005. X * 
  1006. X *  compile with -lsuntool -lsunwindow -lpixrect
  1007. X *
  1008. X */
  1009. X
  1010. X
  1011. X/* global vars */
  1012. Xstatic struct pixrect    *tmpdst=NULL;
  1013. X
  1014. X
  1015. Xquit_mag()
  1016. X{
  1017. X MY_pr_destroy(tmpdst);
  1018. X}
  1019. X
  1020. X
  1021. Xinit_mag()
  1022. X{
  1023. X MY_pr_destroy(tmpdst);
  1024. X tmpdst = my_mem_create(SCREEN_MAX_X, SCREEN_MAX_Y, image_depth);
  1025. X}
  1026. X
  1027. X
  1028. X/*
  1029. X * pw_mag copies a magnified view of spr to dpw using pixel replication.
  1030. X * the arguments are the same as those to the pw_rop library call, except
  1031. X * that magnification is passed instead of raster-op.
  1032. X */
  1033. Xvoid pw_mag(dpw, dx, dy, w, h, mag, spr, sx, sy)
  1034. X    Pixwin *dpw;    /* destination pixwin */
  1035. X    int dx, dy;      /* destination x,y */
  1036. X    int w, h;    /* width and height of block to copy */
  1037. X    int mag;     /* magnification */
  1038. X    struct pixrect *spr;    /* source pixrect */
  1039. X    int sx,sy;    /* location in source to copy from */
  1040. X{
  1041. X    /* locals */
  1042. X    register short jmax = h/mag + 1, imax = w/mag + 1;
  1043. X    register short x, y, delta;
  1044. X
  1045. X    struct pixrect r;    /* holds the size of the drawing region when */
  1046. X            /* gaining access to the screen */
  1047. X    r.pr_size.x = w;
  1048. X    r.pr_size.y = h;
  1049. X
  1050. X    for (x = 0; x < imax; x += 1) {
  1051. X        for (delta = 0; delta < mag; delta += 1) {
  1052. X            pr_rop(tmpdst, x*mag+delta, 0, 1, jmax, PIX_SRC|PIX_DONTCLIP, spr, sx+x, sy);
  1053. X        }
  1054. X    }
  1055. X    for (y = jmax; y >= 0; y -= 1) {
  1056. X        for (delta = 0; delta < mag; delta += 1) {
  1057. X            pr_rop(tmpdst, 0, y*mag+delta, w, 1, PIX_SRC|PIX_DONTCLIP, tmpdst, 0, y);
  1058. X        }
  1059. X    }
  1060. X
  1061. X    /* draw */
  1062. X    pw_rop(dpw, dx, dy, w, h, PIX_SRC, tmpdst, 0, 0);
  1063. X}
  1064. END_OF_magnify.c
  1065. if test 1789 -ne `wc -c <magnify.c`; then
  1066.     echo shar: \"magnify.c\" unpacked with wrong size!
  1067. fi
  1068. # end of overwriting check
  1069. fi
  1070. if test -f oval.c -a "${1}" != "-c" ; then 
  1071.   echo shar: Will not over-write existing file \"oval.c\"
  1072. else
  1073. echo shar: Extracting \"oval.c\" \(4269 characters\)
  1074. sed "s/^X//" >oval.c <<'END_OF_oval.c'
  1075. X
  1076. X/**************************************************************************
  1077. X   Touchup a bitmap graphics editor for the Sun Workstation running SunView
  1078. X   Copyright (c) 1988 by Raymond Kreisel
  1079. X   1/22/88 @ Suny Stony Brook
  1080. X
  1081. X   This program may be redistributed without fee as long as this copyright
  1082. X   notice is intact.
  1083. X
  1084. X==> PLEASE send comments and bug reports to one of the following addresses:
  1085. X
  1086. X       Ray Kreisel
  1087. X       CS Dept., SUNY at Stony Brook, Stony Brook NY 11794
  1088. X
  1089. X       UUCP: {allegra, philabs, pyramid, research}!sbcs!rayk   
  1090. X       ARPA-Internet: rayk@sbcs.sunysb.edu            
  1091. X       CSnet: rayk@suny-sb
  1092. X       (If nobody is home at any of the above addresses try:
  1093. X        S72QKRE@TOWSONVX.BITNET                    )
  1094. X
  1095. X "If I get home before daylight, I just might get some sleep tonight...."
  1096. X
  1097. X**************************************************************************/
  1098. X/**************************************************************************
  1099. X    file: oval.c
  1100. X    purpose: this file contain the functions that draw ovals
  1101. X
  1102. X    modifications:
  1103. X        date:    Tue Mar 22 22:04:58 EST 1988
  1104. X        author:    rayk
  1105. X        changes:add comments
  1106. X**************************************************************************/
  1107. X
  1108. X#include"header.h"
  1109. X
  1110. X
  1111. X/*
  1112. X * draw an oval by making the sides by vectors and ends by semicircles
  1113. X */
  1114. X     draw_oval(pw, center_x,center_y, curr_pos_x,curr_pos_y,flag)
  1115. X
  1116. X       Pixwin            *pw;
  1117. X       int         center_x,center_y,curr_pos_x,curr_pos_y;
  1118. X       int                flag;
  1119. X   
  1120. X     {    
  1121. X       struct  pr_pos     center,
  1122. X                         curr_pos;
  1123. X        int             x, y, radius,
  1124. X            error, npts,
  1125. X                h_width, h_height,
  1126. X            x_off, y_off,ROP;
  1127. X
  1128. X    if (flag)
  1129. X     {
  1130. X      if (image_depth > 1)
  1131. X          ROP = PIX_SRC;
  1132. X      else
  1133. X        ROP = PIX_SET;
  1134. X     }
  1135. X        else
  1136. X       ROP = PIX_XOR;
  1137. X
  1138. X    center.x = center_x;
  1139. X    center.y = center_y;
  1140. X    curr_pos.x = curr_pos_x;
  1141. X    curr_pos.y = curr_pos_y;
  1142. X
  1143. X          h_width = abs(curr_pos.x - center.x);
  1144. X          h_height = abs(curr_pos.y - center.y);
  1145. X          radius = MIN(h_width, h_height);
  1146. X  
  1147. X         /*
  1148. X      * draw line section of oval
  1149. X          */
  1150. X          if (radius == h_height)
  1151. X           { x_off = h_width-radius;   y_off = 0;
  1152. X             pw_vector(pw, center.x-x_off, center.y+radius,
  1153. X                       center.x+x_off, center.y+radius, ROP, cur_color);
  1154. X             pw_vector(pw, center.x-x_off, center.y-radius,
  1155. X                       center.x+x_off, center.y-radius, ROP, cur_color);
  1156. X           }
  1157. X          else
  1158. X           { x_off = 0;   y_off = h_height-radius;
  1159. X             pw_vector(pw, center.x-radius, center.y-y_off,
  1160. X                       center.x-radius, center.y+y_off, ROP, cur_color);
  1161. X             pw_vector(pw, center.x+radius, center.y-y_off,
  1162. X                       center.x+radius, center.y+y_off, ROP, cur_color);
  1163. X           }
  1164. X       /*
  1165. X        * draw rounded corners of oval
  1166. X        */
  1167. X       x = 0;  y = radius; npts = 0;
  1168. X       error = 3 - (radius << 1);
  1169. X
  1170. X         while (x < y)
  1171. X         {
  1172. X           ptlist[npts].x=center.x+(x+x_off); ptlist[npts++].y=center.y+(y+y_off);
  1173. X           ptlist[npts].x=center.x-(x+x_off); ptlist[npts++].y=center.y+(y+y_off);
  1174. X           ptlist[npts].x=center.x+(x+x_off); ptlist[npts++].y=center.y-(y+y_off);
  1175. X           ptlist[npts].x=center.x-(x+x_off); ptlist[npts++].y=center.y-(y+y_off);
  1176. X           ptlist[npts].x=center.x+(y+x_off); ptlist[npts++].y=center.y+(x+y_off);
  1177. X           ptlist[npts].x=center.x-(y+x_off); ptlist[npts++].y=center.y+(x+y_off);
  1178. X           ptlist[npts].x=center.x+(y+x_off); ptlist[npts++].y=center.y-(x+y_off);
  1179. X           ptlist[npts].x=center.x-(y+x_off); ptlist[npts++].y=center.y-(x+y_off);
  1180. X             
  1181. X           if (error < 0)
  1182. X              error = error + (x << 2) + 6;
  1183. X           else
  1184. X              error = error + ((x-y--) << 2) + 10;
  1185. X           x++;
  1186. X          }  /* end of while (x , y) */
  1187. X          if (x == y)
  1188. X          {
  1189. X           ptlist[npts].x=center.x+(x+x_off); ptlist[npts++].y=center.y+(y+y_off);
  1190. X           ptlist[npts].x=center.x-(x+x_off); ptlist[npts++].y=center.y+(y+y_off);
  1191. X           ptlist[npts].x=center.x+(x+x_off); ptlist[npts++].y=center.y-(y+y_off);
  1192. X           ptlist[npts].x=center.x-(x+x_off); ptlist[npts++].y=center.y-(y+y_off);
  1193. X          }
  1194. X          if (flag)
  1195. X        my_pw_polypoint(pw,0,0,npts,ptlist,ROP);
  1196. X}  /* end of function draw_oval() */
  1197. X
  1198. END_OF_oval.c
  1199. if test 4269 -ne `wc -c <oval.c`; then
  1200.     echo shar: \"oval.c\" unpacked with wrong size!
  1201. fi
  1202. # end of overwriting check
  1203. fi
  1204. if test -f pattern.c -a "${1}" != "-c" ; then 
  1205.   echo shar: Will not over-write existing file \"pattern.c\"
  1206. else
  1207. echo shar: Extracting \"pattern.c\" \(6279 characters\)
  1208. sed "s/^X//" >pattern.c <<'END_OF_pattern.c'
  1209. X
  1210. X/**************************************************************************
  1211. X   Touchup a bitmap graphics editor for the Sun Workstation running SunView
  1212. X   Copyright (c) 1988 by Raymond Kreisel
  1213. X   1/22/88 @ Suny Stony Brook
  1214. X
  1215. X   This program may be redistributed without fee as long as this copyright
  1216. X   notice is intact.
  1217. X
  1218. X==> PLEASE send comments and bug reports to one of the following addresses:
  1219. X
  1220. X       Ray Kreisel
  1221. X       CS Dept., SUNY at Stony Brook, Stony Brook NY 11794
  1222. X
  1223. X       UUCP: {allegra, philabs, pyramid, research}!sbcs!rayk   
  1224. X       ARPA-Internet: rayk@sbcs.sunysb.edu            
  1225. X       CSnet: rayk@suny-sb
  1226. X       (If nobody is home at any of the above addresses try:
  1227. X        S72QKRE@TOWSONVX.BITNET                    )
  1228. X
  1229. X "If I get home before daylight, I just might get some sleep tonight...."
  1230. X
  1231. X**************************************************************************/
  1232. X/**************************************************************************
  1233. X    file: pattern.c
  1234. X    purpose: this file has all of the paint patterns
  1235. X
  1236. X    modifications:
  1237. X        date:    Tue Mar 22 22:04:58 EST 1988
  1238. X        author:    rayk
  1239. X        changes:add comments
  1240. X**************************************************************************/
  1241. X
  1242. X#include <pixrect/pixrect_hs.h>
  1243. X
  1244. X
  1245. Xstatic short pattern1_data[] = {
  1246. X#include "pattern1.icon.pat"
  1247. X};
  1248. Xstatic mpr_static(pattern1_pr, 32, 32, 1, pattern1_data);
  1249. X
  1250. Xstatic short pattern2_data[] = {
  1251. X#include "pattern2.icon.pat"
  1252. X};
  1253. Xstatic mpr_static(pattern2_pr, 32, 32, 1, pattern2_data);
  1254. X
  1255. Xstatic short pattern3_data[] = {
  1256. X#include "pattern3.icon.pat"
  1257. X};
  1258. Xstatic mpr_static(pattern3_pr, 32, 32, 1, pattern3_data);
  1259. X
  1260. Xstatic short pattern4_data[] = {
  1261. X#include "pattern4.icon.pat"
  1262. X};
  1263. Xstatic mpr_static(pattern4_pr, 32, 32, 1, pattern4_data);
  1264. X
  1265. Xstatic short pattern5_data[] = {
  1266. X#include "pattern5.icon.pat"
  1267. X};
  1268. Xstatic mpr_static(pattern5_pr, 32, 32, 1, pattern5_data);
  1269. X
  1270. Xstatic short pattern6_data[] = {
  1271. X#include "pattern6.icon.pat"
  1272. X};
  1273. Xstatic mpr_static(pattern6_pr, 32, 32, 1, pattern6_data);
  1274. X
  1275. Xstatic short pattern7_data[] = {
  1276. X#include "pattern7.icon.pat"
  1277. X};
  1278. Xstatic mpr_static(pattern7_pr, 32, 32, 1, pattern7_data);
  1279. X
  1280. Xstatic short pattern8_data[] = {
  1281. X#include "pattern8.icon.pat"
  1282. X};
  1283. Xstatic mpr_static(pattern8_pr, 32, 32, 1, pattern8_data);
  1284. X
  1285. Xstatic short pattern9_data[] = {
  1286. X#include "pattern9.icon.pat"
  1287. X};
  1288. Xstatic mpr_static(pattern9_pr, 32, 32, 1, pattern9_data);
  1289. X
  1290. Xstatic short pattern10_data[] = {
  1291. X#include "pattern10.icon.pat"
  1292. X};
  1293. Xstatic mpr_static(pattern10_pr, 32, 32, 1, pattern10_data);
  1294. X
  1295. Xstatic short pattern11_data[] = {
  1296. X#include "pattern11.icon.pat"
  1297. X};
  1298. Xstatic mpr_static(pattern11_pr, 32, 32, 1, pattern11_data);
  1299. X
  1300. Xstatic short pattern12_data[] = {
  1301. X#include "pattern12.icon.pat"
  1302. X};
  1303. Xstatic mpr_static(pattern12_pr, 32, 32, 1, pattern12_data);
  1304. X
  1305. Xstatic short pattern13_data[] = {
  1306. X#include "pattern13.icon.pat"
  1307. X};
  1308. Xstatic mpr_static(pattern13_pr, 32, 32, 1, pattern13_data);
  1309. X
  1310. Xstatic short pattern14_data[] = {
  1311. X#include "pattern14.icon.pat"
  1312. X};
  1313. Xstatic mpr_static(pattern14_pr, 32, 32, 1, pattern14_data);
  1314. X
  1315. Xstatic short pattern15_data[] = {
  1316. X#include "pattern15.icon.pat"
  1317. X};
  1318. Xstatic mpr_static(pattern15_pr, 32, 32, 1, pattern15_data);
  1319. X
  1320. Xstatic short pattern16_data[] = {
  1321. X#include "pattern16.icon.pat"
  1322. X};
  1323. Xstatic mpr_static(pattern16_pr, 32, 32, 1, pattern16_data);
  1324. X
  1325. Xstatic short pattern17_data[] = {
  1326. X#include "pattern17.icon.pat"
  1327. X};
  1328. Xstatic mpr_static(pattern17_pr, 32, 32, 1, pattern17_data);
  1329. X
  1330. Xstatic short pattern18_data[] = {
  1331. X#include "pattern18.icon.pat"
  1332. X};
  1333. Xstatic mpr_static(pattern18_pr, 32, 32, 1, pattern18_data);
  1334. X
  1335. Xstatic short pattern19_data[] = {
  1336. X#include "pattern19.icon.pat"
  1337. X};
  1338. Xstatic mpr_static(pattern19_pr, 32, 32, 1, pattern19_data);
  1339. X
  1340. Xstatic short pattern20_data[] = {
  1341. X#include "pattern20.icon.pat"
  1342. X};
  1343. Xstatic mpr_static(pattern20_pr, 32, 32, 1, pattern20_data);
  1344. X
  1345. Xstatic short pattern21_data[] = {
  1346. X#include "pattern21.icon.pat"
  1347. X};
  1348. Xstatic mpr_static(pattern21_pr, 32, 32, 1, pattern21_data);
  1349. X
  1350. Xstatic short pattern22_data[] = {
  1351. X#include "pattern22.icon.pat"
  1352. X};
  1353. Xstatic mpr_static(pattern22_pr, 32, 32, 1, pattern22_data);
  1354. X
  1355. Xstatic short pattern23_data[] = {
  1356. X#include "pattern23.icon.pat"
  1357. X};
  1358. Xstatic mpr_static(pattern23_pr, 32, 32, 1, pattern23_data);
  1359. X
  1360. Xstatic short pattern24_data[] = {
  1361. X#include "pattern24.icon.pat"
  1362. X};
  1363. Xstatic mpr_static(pattern24_pr, 32, 32, 1, pattern24_data);
  1364. X
  1365. Xstatic short pattern25_data[] = {
  1366. X#include "pattern25.icon.pat"
  1367. X};
  1368. Xstatic mpr_static(pattern25_pr, 32, 32, 1, pattern25_data);
  1369. X
  1370. Xstatic short pattern26_data[] = {
  1371. X#include "pattern26.icon.pat"
  1372. X};
  1373. Xstatic mpr_static(pattern26_pr, 32, 32, 1, pattern26_data);
  1374. X
  1375. Xstatic short pattern27_data[] = {
  1376. X#include "pattern27.icon.pat"
  1377. X};
  1378. Xstatic mpr_static(pattern27_pr, 32, 32, 1, pattern27_data);
  1379. X
  1380. Xstatic short pattern28_data[] = {
  1381. X#include "pattern28.icon.pat"
  1382. X};
  1383. Xstatic mpr_static(pattern28_pr, 32, 32, 1, pattern28_data);
  1384. X
  1385. Xstatic short pattern29_data[] = {
  1386. X#include "pattern29.icon.pat"
  1387. X};
  1388. Xstatic mpr_static(pattern29_pr, 32, 32, 1, pattern29_data);
  1389. X
  1390. Xstatic short pattern30_data[] = {
  1391. X#include "pattern30.icon.pat"
  1392. X};
  1393. Xstatic mpr_static(pattern30_pr, 32, 32, 1, pattern30_data);
  1394. X
  1395. Xstatic short pattern31_data[] = {
  1396. X#include "pattern31.icon.pat"
  1397. X};
  1398. Xstatic mpr_static(pattern31_pr, 32, 32, 1, pattern31_data);
  1399. X
  1400. Xstatic short pattern32_data[] = {
  1401. X#include "pattern32.icon.pat"
  1402. X};
  1403. Xstatic mpr_static(pattern32_pr, 32, 32, 1, pattern32_data);
  1404. X
  1405. Xstatic short pattern33_data[] = {
  1406. X#include "pattern33.icon.pat"
  1407. X};
  1408. Xstatic mpr_static(pattern33_pr, 32, 32, 1, pattern33_data);
  1409. X
  1410. Xstatic short pattern34_data[] = {
  1411. X#include "pattern34.icon.pat"
  1412. X};
  1413. Xstatic mpr_static(pattern34_pr, 32, 32, 1, pattern34_data);
  1414. X
  1415. Xstatic short pattern35_data[] = {
  1416. X#include "pattern35.icon.pat"
  1417. X};
  1418. Xstatic mpr_static(pattern35_pr, 32, 32, 1, pattern35_data);
  1419. X
  1420. Xstatic short pattern36_data[] = {
  1421. X#include "pattern36.icon.pat"
  1422. X};
  1423. Xstatic mpr_static(pattern36_pr, 32, 32, 1, pattern36_data);
  1424. X
  1425. Xstatic short pattern37_data[] = {
  1426. X#include "pattern37.icon.pat"
  1427. X};
  1428. Xstatic mpr_static(pattern37_pr, 32, 32, 1, pattern37_data);
  1429. X
  1430. Xstatic short pattern38_data[] = {
  1431. X#include "pattern38.icon.pat"
  1432. X};
  1433. Xstatic mpr_static(pattern38_pr, 32, 32, 1, pattern38_data);
  1434. X
  1435. Xstatic short pattern39_data[] = {
  1436. X#include "pattern39.icon.pat"
  1437. X};
  1438. Xstatic mpr_static(pattern39_pr, 32, 32, 1, pattern39_data);
  1439. X
  1440. Xstatic short pattern40_data[] = {
  1441. X#include "pattern40.icon.pat"
  1442. X};
  1443. Xstatic mpr_static(pattern40_pr, 32, 32, 1, pattern40_data);
  1444. X
  1445. X
  1446. END_OF_pattern.c
  1447. if test 6279 -ne `wc -c <pattern.c`; then
  1448.     echo shar: \"pattern.c\" unpacked with wrong size!
  1449. fi
  1450. # end of overwriting check
  1451. fi
  1452. if test -f touchup.c -a "${1}" != "-c" ; then 
  1453.   echo shar: Will not over-write existing file \"touchup.c\"
  1454. else
  1455. echo shar: Extracting \"touchup.c\" \(19131 characters\)
  1456. sed "s/^X//" >touchup.c <<'END_OF_touchup.c'
  1457. X
  1458. X/**************************************************************************
  1459. X   Touchup a bitmap graphics editor for the Sun Workstation running SunView
  1460. X   Copyright (c) 1988 by Raymond Kreisel
  1461. X   1/22/88 @ Suny Stony Brook
  1462. X
  1463. X   This program may be redistributed without fee as long as this copyright
  1464. X   notice is intact.
  1465. X
  1466. X==> PLEASE send comments and bug reports to one of the following addresses:
  1467. X
  1468. X       Ray Kreisel
  1469. X       CS Dept., SUNY at Stony Brook, Stony Brook NY 11794
  1470. X
  1471. X       UUCP: {allegra, philabs, pyramid, research}!sbcs!rayk   
  1472. X       ARPA-Internet: rayk@sbcs.sunysb.edu            
  1473. X       CSnet: rayk@suny-sb
  1474. X       (If nobody is home at any of the above addresses try:
  1475. X        S72QKRE@TOWSONVX.BITNET                    )
  1476. X
  1477. X "If I get home before daylight, I just might get some sleep tonight...."
  1478. X
  1479. X**************************************************************************/
  1480. X/**************************************************************************
  1481. X    file: touchup.c
  1482. X    purpose: this file has misc functions that do different crap
  1483. X        but mostly the event handler for the main drawing
  1484. X        area
  1485. X    modifications:
  1486. X        date:    Tue Mar 22 22:04:58 EST 1988
  1487. X        author:    rayk
  1488. X        changes:add comments
  1489. X**************************************************************************/
  1490. X
  1491. X#include "header.h"
  1492. X
  1493. Xunsigned char red[256],green[256],blue[256];
  1494. Xint image_wid= DEFAULT_IMAGE_WID,image_hgt= DEFAULT_IMAGE_HGT,image_depth=1;
  1495. Xint top_x=0,top_y=0,bottom_x=0,bottom_y=0;
  1496. Xint cur_color=1,grid_size=0;
  1497. Xint magnify_fac=8,fat_x,fat_y,fat_source_x=0-1,fat_source_y=0-1;
  1498. Xint mouse_left=PAINT,undo_flag=TRUE;
  1499. Xint select_pt_x=0-1,select_pt_y=0-1;
  1500. Xint old_x=0; old_y=0;
  1501. Xint start_x=0; start_y=0;
  1502. Xchar file_name[MAX_FILE_NAME];
  1503. Xstruct pixrect *cut_buffer_pr=NULL,
  1504. X        *undo_pr=NULL;
  1505. X
  1506. Xstruct pixfont *main_font=NULL;
  1507. X
  1508. X/*
  1509. X * this is the event handler for the special cut/paste command menu
  1510. X */
  1511. Xregion_handle(item, event)
  1512. XPanel_item      item;
  1513. XEvent           *event;
  1514. X{
  1515. X    switch((int)panel_get_value(region_choice)) {
  1516. X    case CUT:
  1517. X        cut_region();
  1518. X            break;
  1519. X    case COPY:
  1520. X        print_msg("Region copied to Cut/Paste buffer. Hold down the RIGHT mouse button to drag the object.");
  1521. X        panel_set(region_choice,PANEL_VALUE,MOVE,0);
  1522. X        copy_region();
  1523. X            break;
  1524. X    case FLIP_HOR:
  1525. X        flip_hor_region();
  1526. X            break;
  1527. X    case FLIP_VER:
  1528. X        flip_ver_region();
  1529. X            break;
  1530. X    case ROTATE:
  1531. X        rotate_region();
  1532. X            break;
  1533. X    case INVERSE:
  1534. X        inverse_region();
  1535. X            break;
  1536. X    case PASTE:
  1537. X                paste_region();
  1538. X            break;
  1539. X    case MOVE:
  1540. X        print_msg("Hold down the RIGHT mouse button and drag the object.");
  1541. X            break;
  1542. X    }
  1543. X
  1544. X}
  1545. X
  1546. X
  1547. X/*
  1548. X * this is the event handler for the main comand menu
  1549. X */
  1550. Xcommand_handle(item, event)
  1551. XPanel_item      item;
  1552. XEvent           *event;
  1553. X{
  1554. X  hide_msg();
  1555. X  if ((int)panel_get_value(command_choice) != GET_PT)
  1556. X    {
  1557. X      (void)window_set(region_panel, WIN_SHOW, FALSE, 0);
  1558. X      panel_set(region_choice,PANEL_VALUE,5,0);
  1559. X    }
  1560. X  (void)window_set(brush_panel, WIN_SHOW, FALSE, 0);
  1561. X    switch((int)panel_get_value(command_choice)) {
  1562. X    case TEXT:
  1563. X          draw_text();
  1564. X            break;
  1565. X    case LASO:
  1566. X          print_msg("Hold down the LEFT mouse button and encircle a object.");
  1567. X          mouse_parms();
  1568. X            break;
  1569. X    case CIRCLE:
  1570. X          print_msg("Hold down the LEFT mouse button and extend to radius of the circle.");
  1571. X          mouse_parms();
  1572. X            break;
  1573. X    case DRAW:
  1574. X          print_msg("Press the LEFT mouse button to DRAW.");
  1575. X          mouse_parms();
  1576. X            break;
  1577. X    case LINE:
  1578. X          print_msg("Hold down the LEFT mouse button and extend to end of the line.");
  1579. X          mouse_parms();
  1580. X            break;
  1581. X    case MAGNIFY:
  1582. X          print_msg("Use LEFT button to draw, hold down MIDDLE button to move.");
  1583. X          fat_mode();
  1584. X            break;
  1585. X    case FFILL:
  1586. X          fill_mode(item, event);
  1587. X          mouse_parms();
  1588. X            break;
  1589. X    case OVAL:
  1590. X             print_msg("Hold down the LEFT mouse button and extend to edge of the oval.");
  1591. X          mouse_parms();
  1592. X            break;
  1593. X    case POLY_F:
  1594. X    case POLY_H:
  1595. X          print_msg("Press the LEFT mouse button to select a vertex.");
  1596. X          mouse_parms();
  1597. X            break;
  1598. X    case RECT_F:
  1599. X    case RECT_H:
  1600. X          print_msg("Hold down the LEFT mouse button and extend to the opposite corner.");
  1601. X          mouse_parms();
  1602. X            break;
  1603. X    case PAINT:
  1604. X          print_msg("Press the LEFT mouse button to PAINT.");
  1605. X          mouse_parms();
  1606. X          (void)window_set(brush_panel, WIN_SHOW, TRUE, 0);
  1607. X            break;
  1608. X    case SEL_REG:
  1609. X          print_msg("Hold down the LEFT mouse button and extend to the opposite corner.");
  1610. X          if (mouse_left == SEL_REG)
  1611. X            {
  1612. X              clean_region();
  1613. X              top_x = 0;
  1614. X              top_y = 0;
  1615. X                  bottom_x = image_wid;
  1616. X              bottom_y = image_hgt;
  1617. X              select_region(pw,top_x,top_y,bottom_x,bottom_y);
  1618. X            }
  1619. X          else
  1620. X            {
  1621. X              mouse_parms();
  1622. X            }
  1623. X          (void)window_set(region_panel, WIN_SHOW, TRUE, 0);
  1624. X          break;
  1625. X    case GET_PT:
  1626. X          print_msg("Press the LEFT mouse button to select a point.");
  1627. X          mouse_parms();
  1628. X            break;
  1629. X    case ERASE:
  1630. X          print_msg("Press the LEFT MOUSE button to ERASE.");
  1631. X          if ((mouse_left == ERASE) &&  (confirm("Erase entire drawing area ?")))
  1632. X            {
  1633. X            clear_screen();
  1634. X            (void)window_set(canvas,
  1635. X                  CANVAS_WIDTH,        DEFAULT_IMAGE_WID,
  1636. X                  CANVAS_HEIGHT,    DEFAULT_IMAGE_HGT,
  1637. X                0);
  1638. X            }
  1639. X          else
  1640. X                    if (top_x || top_y || bottom_x || bottom_y)
  1641. X                {
  1642. X             select_region(pw,top_x,top_y,bottom_x,bottom_y);
  1643. X               region_fix();
  1644. X                 pw_rop(pw,top_x,top_y,bottom_x-top_x,bottom_y-top_y,PIX_SRC,0,0,0);
  1645. X             reset_region();
  1646. X                }
  1647. X          mouse_parms();
  1648. X            break;
  1649. X
  1650. X    }
  1651. X
  1652. X}     
  1653. X
  1654. X
  1655. X
  1656. X/*
  1657. X * save the screen to a temp bitmap for the undo command
  1658. X */
  1659. Xsave_screen()
  1660. X{
  1661. X  if (undo_flag)
  1662. X  {
  1663. X    if (undo_pr == NULL)
  1664. X      undo_pr =my_mem_create(image_wid,image_hgt,image_depth);
  1665. X    pr_rop(undo_pr,0,0,image_wid,image_hgt,PIX_SRC,pw->pw_prretained,0,0);
  1666. X  }
  1667. X}     
  1668. X
  1669. X
  1670. X/*
  1671. X * go back to the last saved bitmap
  1672. X */
  1673. Xundo_screen(item, event)
  1674. XPanel_item      item;
  1675. XEvent           *event;
  1676. X{
  1677. X  if (undo_flag)
  1678. X  {
  1679. X    clean_region();
  1680. X    clean_point();
  1681. X    clean_poly();
  1682. X    fat_done();
  1683. X    pw_write(pw,0,0, image_wid,image_hgt, PIX_SRC, undo_pr,0,0);
  1684. X  }
  1685. X}     
  1686. X
  1687. X
  1688. X
  1689. X/*
  1690. X * clear the drawing area
  1691. X */
  1692. Xclear_screen(item, event)
  1693. XPanel_item      item;
  1694. XEvent           *event;
  1695. X{
  1696. X  clean_point();
  1697. X  clean_region();
  1698. X  save_screen();
  1699. X  fat_done();
  1700. X  pw_write( pw,0,0,1280,1280,PIX_SRC,0,0,0);
  1701. X  pw_write( fat_pw,0,0,1280,1280,PIX_SRC,0,0,0);
  1702. X}
  1703. X
  1704. X
  1705. X/*
  1706. X * if there is a region that is select the deselect it
  1707. X */
  1708. Xclean_region()
  1709. X{
  1710. X  if (top_x || top_y || bottom_x || bottom_y)
  1711. X    {
  1712. X     select_region(pw,top_x,top_y,bottom_x,bottom_y);
  1713. X     reset_region();
  1714. X    }
  1715. X}
  1716. X
  1717. X
  1718. X/*
  1719. X * if there is a point that is selected then deselecte it
  1720. X */
  1721. Xclean_point()
  1722. X{
  1723. X  if (select_pt_x != -1)
  1724. X    {
  1725. X     select_point(select_pt_x,select_pt_y);
  1726. X     select_pt_x = -1;
  1727. X     select_pt_y = -1;
  1728. X    }
  1729. X}
  1730. X
  1731. X
  1732. X/*
  1733. X * deselect any points and regions and get the current command mode
  1734. X */
  1735. Xmouse_parms(item, event)
  1736. XPanel_item      item;
  1737. XEvent           *event;
  1738. X{
  1739. X  clean_point();
  1740. X  clean_region();
  1741. X  fat_done();
  1742. X  mouse_left = (int)panel_get_value(command_choice);
  1743. X}
  1744. X
  1745. X
  1746. X/*
  1747. X * set it to select a point mode
  1748. X */
  1749. Xset_select_mode()
  1750. X{
  1751. X  panel_set(command_choice,PANEL_VALUE, GET_PT,0);
  1752. X  mouse_parms();
  1753. X}
  1754. X
  1755. X
  1756. X
  1757. X/*
  1758. X * this the main event handler that makes the whole thing go
  1759. X * this event handle is for that canvas that is the main drawing area
  1760. X */
  1761. Xhandle_event(canvas_local, event, arg)
  1762. XCanvas  canvas_local;
  1763. XEvent   *event;
  1764. Xcaddr_t arg;
  1765. X{
  1766. X    Pixwin      *pw     = canvas_pixwin(canvas_local);
  1767. X
  1768. X    if (grid_size)
  1769. X     {
  1770. X    event_set_x(event,event_x(event) + grid_size/2 - (event_x(event)%grid_size));
  1771. X        event_set_y(event,event_y(event) + grid_size/2 - (event_y(event)%grid_size));
  1772. X     }
  1773. X
  1774. X    if (event_is_up(event))
  1775. X    {
  1776. X        if (event_id(event) == MS_LEFT)
  1777. X        {
  1778. X        if ((mouse_left == RECT_H) || (mouse_left == RECT_F))
  1779. X           draw_rectangle(start_x,start_y,event_x(event), event_y(event));
  1780. X        if (mouse_left == LINE)
  1781. X           draw_line(start_x,start_y,event_x(event), event_y(event),PIX_SRC,cur_color);
  1782. X        if (mouse_left == ERASE)
  1783. X             {
  1784. X                   select_region(pw,top_x,top_y,top_x+PATTERN_SIZE,top_y+PATTERN_SIZE);
  1785. X               reset_region();
  1786. X             }
  1787. X
  1788. X        if (mouse_left == CIRCLE)
  1789. X                     {
  1790. X                 draw_line(start_x,start_y,old_x,old_y,PIX_XOR,1);
  1791. X                draw_circle(pw,start_x,start_y,distance(old_x,old_y,start_x,start_y),1,PIX_SET);
  1792. X             }
  1793. X
  1794. X        if (mouse_left == OVAL)
  1795. X           draw_oval(pw,start_x,start_y,old_x,old_y,TRUE);
  1796. X
  1797. X                if (fat_source_x != -1)
  1798. X                   fat_update(0,0);
  1799. X        if (mouse_left == GET_PT)
  1800. X         {
  1801. X             select_pt_x = event_x(event);
  1802. X           select_pt_y = event_y(event);
  1803. X         }
  1804. X        if (mouse_left == LASO)
  1805. X        {
  1806. X           laso_cut_paste();
  1807. X           panel_set(region_choice,PANEL_VALUE,MOVE,0);
  1808. X           panel_set(command_choice,PANEL_VALUE,SEL_REG,0);
  1809. X               (void)window_set(brush_panel, WIN_SHOW,FALSE, 0);
  1810. X               (void)window_set(region_panel, WIN_SHOW,TRUE, 0);
  1811. X           print_msg("Object copied to Cut/Paste buffer. Hold down the RIGHT mouse button to drag the object.");
  1812. X           mouse_parms();
  1813. X        }
  1814. X          }
  1815. X        if (event_id(event) == MS_RIGHT)
  1816. X        {
  1817. X                  if (((int)panel_get_value(region_choice) == MOVE) && (cut_buffer_pr != NULL))
  1818. X            {
  1819. X                 pw_write(pw,old_x- cut_buffer_pr->pr_size.x/2,
  1820. X                     old_y- cut_buffer_pr->pr_size.y/2,
  1821. X                     cut_buffer_pr->pr_size.x,
  1822. X                     cut_buffer_pr->pr_size.y,
  1823. X                     PIX_XOR, cut_buffer_pr,0,0);
  1824. X               pw_write(pw,event_x(event)-cut_buffer_pr->pr_size.x/2,
  1825. X                   event_y(event)-cut_buffer_pr->pr_size.y/2,
  1826. X                 cut_buffer_pr->pr_size.x,
  1827. X                 cut_buffer_pr->pr_size.y,
  1828. X                 PIX_SRC | PIX_DST, cut_buffer_pr,0,0);
  1829. X            }
  1830. X        }
  1831. X         return;
  1832. X    }
  1833. X    switch (event_id(event)) {
  1834. X     case MS_LEFT:
  1835. X        if ((mouse_left != POLY_H) && (mouse_left != POLY_F) && (mouse_left != GET_PT) && (mouse_left != SEL_REG))
  1836. X            save_screen();
  1837. X        old_x = event_x(event);
  1838. X        old_y = event_y(event);
  1839. X        start_x = event_x(event);
  1840. X        start_y = event_y(event);
  1841. X        switch(mouse_left) {
  1842. X
  1843. X        case LINE:
  1844. X               draw_line(old_x,old_y,start_x,start_y,PIX_XOR,1);
  1845. X               break;
  1846. X        case POLY_F:
  1847. X        case POLY_H:
  1848. X               if (poly_points[0].x == -1)
  1849. X                save_screen();            
  1850. X               poly_addpt(poly_points,start_x,start_y);
  1851. X               print_msg("Press the LEFT button to select a vertex or press the RIGHT mouse button to end the polygon.");
  1852. X               break;
  1853. X        case DRAW:
  1854. X               draw_point(pw,event_x(event), event_y(event));
  1855. X               break;
  1856. X        case PAINT:
  1857. X               draw_brush(pw, event_x(event), event_y(event));
  1858. X               break;
  1859. X        case ERASE:
  1860. X               top_x = event_x(event)-PATTERN_SIZE/2; top_y= event_y(event)-PATTERN_SIZE/2;
  1861. X               select_region(pw,top_x,top_y,top_x+PATTERN_SIZE,top_y+PATTERN_SIZE);
  1862. X               erase_brush(pw, event_x(event), event_y(event));
  1863. X               break;
  1864. X        case CIRCLE:
  1865. X                    draw_line(start_x,start_y,old_x,old_y,PIX_XOR,1);
  1866. X               break;
  1867. X        case OVAL:
  1868. X                   draw_oval(pw,start_x,start_y,old_x,old_y,FALSE);
  1869. X               break;
  1870. X        case GET_PT:
  1871. X                    if (select_pt_x != -1)
  1872. X                    select_point(select_pt_x,select_pt_y);
  1873. X                      old_x = event_x(event);
  1874. X                     old_y = event_y(event);
  1875. X                     select_point(old_x,old_y);
  1876. X               break;
  1877. X
  1878. X        case SEL_REG:
  1879. X                 if (top_x || top_y || bottom_x || bottom_y)
  1880. X                      select_region(pw,top_x,top_y,bottom_x,bottom_y);
  1881. X               save_screen();
  1882. X                       top_x = event_x(event);
  1883. X                top_y = event_y(event);
  1884. X                       bottom_x = event_x(event);
  1885. X                bottom_y = event_y(event);
  1886. X                 select_region(pw,top_x,top_y,bottom_x,bottom_y);
  1887. X               break;
  1888. X        case LASO:
  1889. X               ptlist[0].x = -1;
  1890. X               ptlist[0].y = -1;
  1891. X               laso_addpt(ptlist,start_x,start_y);
  1892. X               break;
  1893. X        }
  1894. X
  1895. X        break;
  1896. X
  1897. X          case MS_MIDDLE:
  1898. X        switch(mouse_left) {
  1899. X        case SEL_REG:
  1900. X            if (top_x || top_y || bottom_x || bottom_y)
  1901. X            {
  1902. X              select_region(pw,top_x,top_y,bottom_x,bottom_y);
  1903. X                    bottom_x = event_x(event);
  1904. X              bottom_y = event_y(event);
  1905. X               select_region(pw,top_x,top_y,bottom_x,bottom_y);
  1906. X            }
  1907. X            break;
  1908. X        }      
  1909. X        break;
  1910. X          case MS_RIGHT:
  1911. X        if (((mouse_left==POLY_F) || (mouse_left ==POLY_H))
  1912. X           && (poly_points[0].x != -1))
  1913. X         {
  1914. X               poly_addpt(poly_points,event_x(event),event_y(event));
  1915. X               draw_poly(poly_points);
  1916. X         }
  1917. X                if (((int)panel_get_value(region_choice) == MOVE) && (cut_buffer_pr != NULL))
  1918. X            {
  1919. X            clean_region();
  1920. X            clean_point();
  1921. X            save_screen();
  1922. X            old_x = event_x(event);
  1923. X            old_y = event_y(event);
  1924. X            start_x = old_x;
  1925. X            start_y = old_y;
  1926. X                pw_write(pw,old_x - cut_buffer_pr->pr_size.x/2,
  1927. X                    old_y - cut_buffer_pr->pr_size.y/2,
  1928. X                    cut_buffer_pr->pr_size.x,
  1929. X                    cut_buffer_pr->pr_size.y,
  1930. X                    PIX_XOR, cut_buffer_pr,0,0);
  1931. X            }
  1932. X        break;
  1933. X          case LOC_DRAG:
  1934. X            if (window_get(canvas_local, WIN_EVENT_STATE, MS_LEFT))
  1935. X        {
  1936. X        switch(mouse_left) {
  1937. X        case PAINT:
  1938. X            draw_brush(pw, event_x(event), event_y(event));
  1939. X            break;
  1940. X        case DRAW:
  1941. X            draw_point(pw,event_x(event), event_y(event));
  1942. X            break;
  1943. X        case ERASE :
  1944. X            erase_brush(pw, event_x(event), event_y(event));
  1945. X            break;
  1946. X        case LINE:
  1947. X               draw_line(old_x,old_y,start_x,start_y,PIX_XOR,1);
  1948. X                 old_x = event_x(event);
  1949. X               old_y = event_y(event);
  1950. X               draw_line(old_x,old_y,start_x,start_y,PIX_XOR,1);
  1951. X            break;
  1952. X        case RECT_F :
  1953. X        case RECT_H :
  1954. X               select_region(pw,old_x,old_y,start_x,start_y);
  1955. X                 old_x = event_x(event);
  1956. X               old_y = event_y(event);
  1957. X               select_region(pw,old_x,old_y,start_x,start_y);
  1958. X            break;
  1959. X        case CIRCLE:
  1960. X               draw_line(old_x,old_y,start_x,start_y,PIX_XOR,1);
  1961. X                 old_x = event_x(event);
  1962. X               old_y = event_y(event);
  1963. X               draw_line(old_x,old_y,start_x,start_y,PIX_XOR,1);
  1964. X            break;
  1965. X        case OVAL:
  1966. X               draw_oval(pw,start_x,start_y,old_x,old_y,FALSE);
  1967. X                 old_x = event_x(event);
  1968. X               old_y = event_y(event);
  1969. X               draw_oval(pw,start_x,start_y,old_x,old_y,FALSE);
  1970. X            break;
  1971. X        case GET_PT:
  1972. X               select_point(old_x,old_y);
  1973. X                    select_pt_x = event_x(event);
  1974. X                  select_pt_y = event_y(event);
  1975. X                 old_x = event_x(event);
  1976. X               old_y = event_y(event);
  1977. X               select_point(old_x,old_y);
  1978. X            break;
  1979. X        case SEL_REG:
  1980. X              select_region(pw,top_x,top_y,bottom_x,bottom_y);
  1981. X                    bottom_x = event_x(event);
  1982. X              bottom_y = event_y(event);
  1983. X               select_region(pw,top_x,top_y,bottom_x,bottom_y);
  1984. X            break;
  1985. X        case LASO:
  1986. X               laso_addpt(ptlist,event_x(event),event_y(event));
  1987. X            }
  1988. X        case POLY_F:
  1989. X        case POLY_H:
  1990. X            if (poly_points[0].x != -1)
  1991. X             {
  1992. X               draw_line(old_x,old_y,start_x,start_y,PIX_XOR,1);
  1993. X                 old_x = event_x(event);
  1994. X               old_y = event_y(event);
  1995. X               draw_line(old_x,old_y,start_x,start_y,PIX_XOR,1);
  1996. X            }
  1997. X          }
  1998. X            if (window_get(canvas_local, WIN_EVENT_STATE, MS_RIGHT))
  1999. X        {
  2000. X                if ((int)panel_get_value(region_choice) == MOVE)
  2001. X            {
  2002. X              move_region(old_x,old_y,event_x(event),event_y(event));
  2003. X                old_x = event_x(event);
  2004. X              old_y = event_y(event);
  2005. X            }
  2006. X        }
  2007. X        break;
  2008. X          case LOC_MOVE:
  2009. X        if (((mouse_left == POLY_F) || (mouse_left == POLY_H)) &&
  2010. X             (poly_points[0].x != -1))
  2011. X         {
  2012. X           draw_line(old_x,old_y,start_x,start_y,PIX_XOR,1);
  2013. X             old_x = event_x(event);
  2014. X           old_y = event_y(event);
  2015. X           draw_line(old_x,old_y,start_x,start_y,PIX_XOR,1);
  2016. X         }
  2017. X        break;
  2018. X    }
  2019. X}
  2020. X
  2021. X
  2022. X
  2023. X/*
  2024. X * we got a "quit" button, say bye bye
  2025. X */
  2026. Xquit(item, event)
  2027. XPanel_item      item;
  2028. XEvent           *event;
  2029. X
  2030. X{
  2031. X  window_done(base_frame);
  2032. X}
  2033. X
  2034. X
  2035. X/*
  2036. X * get all the current values for some stuff
  2037. X */
  2038. Xchange_parms(item, event)
  2039. XPanel_item      item;
  2040. XEvent           *event;
  2041. X{
  2042. X  if (image_depth == 1)
  2043. X     cur_color = (int)panel_get_value(mono_cycle);
  2044. X  magnify_fac = (int)panel_get_value(magnify_cycle) + 1;
  2045. X  grid_size = (int)panel_get_value(grid_cycle)*5;
  2046. X}
  2047. X
  2048. X
  2049. X
  2050. X/*
  2051. X * this is the main that start the show and then goes into
  2052. X * window main loop
  2053. X */
  2054. Xmain(argc,argv) int argc; char *argv[];
  2055. X{
  2056. Xchar *s;
  2057. X
  2058. X/*
  2059. X * do some agr checking
  2060. X */
  2061. X     while (--argc > 0 && (*++argv)[0] == '-')
  2062. X    for (s = argv[0]+1;*s != '\0';s++)
  2063. X                switch (*s) {
  2064. X          case 'n':
  2065. X                undo_flag = FALSE;
  2066. X                break;
  2067. X          case 'p':
  2068. X                image_hgt = DEFAULT_IMAGE_WID;
  2069. X                image_wid = DEFAULT_IMAGE_HGT;
  2070. X                break;
  2071. X          case 'y': ++argv; argc--;
  2072. X                image_hgt = atoi(argv[0]);
  2073. X                break;
  2074. X          case 'x': ++argv; argc--;
  2075. X                   image_wid = atoi(argv[0]);
  2076. X                  break;
  2077. X          default:  printf("Usage: touchup [-x width] [-y height] [-n] [-p]\n");
  2078. X                exit(0);
  2079. X        }
  2080. X  if (argc > 0)
  2081. X    {
  2082. X      printf("Usage: touchup [-x width] [-y height] [-n] [-p]\n");
  2083. X      exit(0);
  2084. X    }
  2085. X
  2086. X  clean_poly();
  2087. X
  2088. X  /*
  2089. X   * get the font used in all of the panels
  2090. X   */
  2091. X  main_font = pf_open(MAIN_FONT);
  2092. X  if (!main_font)
  2093. X    {
  2094. X     printf("ERROR loading the main font !!!!\n");
  2095. X     exit(1);
  2096. X    }
  2097. X
  2098. X  init_font();
  2099. X  getcwd(file_name,MAX_FILE_NAME-2);
  2100. X  strcat(file_name,"/");
  2101. X  init_windows(argc,argv);
  2102. X  /*
  2103. X   * are we on a color machine ????
  2104. X   */
  2105. X  image_depth = pw->pw_pixrect->pr_depth;
  2106. X  if (image_depth == 8)
  2107. X    {
  2108. X    init_colortable();
  2109. X    my_put_colormap();
  2110. X    set_color();
  2111. X    }
  2112. X  else
  2113. X    set_mono();
  2114. X
  2115. X  if (undo_flag)
  2116. X     undo_pr = my_mem_create(image_wid,image_hgt,image_depth);
  2117. X  else
  2118. X     panel_set(undo_button,PANEL_SHOW_ITEM, FALSE,0);
  2119. X
  2120. X  init_mag();
  2121. X  window_main_loop(base_frame);
  2122. X}
  2123. X
  2124. X
  2125. X
  2126. X/***************************************************************
  2127. X        hide_msg
  2128. X        purpose: To clear the masssage display area.
  2129. X        parameter:
  2130. X        returns:
  2131. X ***************************************************************/
  2132. Xhide_msg()
  2133. X{
  2134. X         panel_set(msg_string,PANEL_LABEL_STRING,"",0);
  2135. X}
  2136. X
  2137. X
  2138. X/***************************************************************
  2139. X        print_msg
  2140. X        purpose: To print a message on the window and center it
  2141. X        parameter:
  2142. X                string: The string to be printed.
  2143. X        returns:
  2144. X ***************************************************************/
  2145. Xprint_msg(string)
  2146. Xchar *string;
  2147. X{
  2148. Xchar temp_space[132];
  2149. Xchar *temp_pt;
  2150. Xint i;
  2151. X  
  2152. X  if (strlen(string) < 132)
  2153. X  {
  2154. X    for(i=0;i<132;i++)
  2155. X      temp_space[i]= ' ';
  2156. X    temp_pt = temp_space + (132-strlen(string))/2;
  2157. X    strcpy(temp_pt,string);
  2158. X    panel_set(msg_string,PANEL_LABEL_STRING,temp_space,0);
  2159. X  }
  2160. X  else
  2161. X    panel_set(msg_string,PANEL_LABEL_STRING,string,0);
  2162. X}
  2163. X
  2164. XERROR(msg)
  2165. Xchar *msg;
  2166. X{ 
  2167. X  print_msg(msg);
  2168. X  window_bell(panel);
  2169. X}
  2170. X
  2171. XERRORstr(msg,str)
  2172. Xchar *msg,*str;
  2173. X{
  2174. Xchar temp[200];
  2175. X  strcpy(temp,msg);
  2176. X  print_msg(strcat(temp,str));
  2177. X  window_bell(panel);
  2178. X}
  2179. X
  2180. X
  2181. X
  2182. X/***************************************************************
  2183. X    sqrt_fast
  2184. X        purpose: To do a fast integer square root
  2185. X        parameter:
  2186. X        n :  the int to take the sqrt of
  2187. X        returns: 
  2188. X        the integer square root of n
  2189. X ***************************************************************/
  2190. Xint sqrt_fast(n)
  2191. Xint n;
  2192. X{
  2193. X   int a,b,c;
  2194. X   a = n;
  2195. X   b = n;
  2196. X   if (n>1){
  2197. X        while (a>0) {
  2198. X            a = a >> 2;
  2199. X            b = b >> 1;
  2200. X    }
  2201. X        do {
  2202. X            a = b;
  2203. X            c = n / b;
  2204. X            b = (c + a) >> 1;
  2205. X    } while ( (a-c)<-1 || (a-c)>1 );
  2206. X   }
  2207. X    return(b);
  2208. X}
  2209. X
  2210. X/*
  2211. X * find the distance between any two points
  2212. X */
  2213. Xdistance(x1,y1,x2,y2)
  2214. Xint x1,y1,x2,y2;
  2215. X{
  2216. X  return(sqrt_fast((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
  2217. X}
  2218. X
  2219. X
  2220. X/*
  2221. X * check if we have enough memory to create those LARGE bitmap
  2222. X */
  2223. Xstruct pixrect *my_mem_create(wid,hgt,dep)
  2224. Xint wid,hgt,dep;
  2225. X{
  2226. Xstruct pixrect* temp_pr;
  2227. X
  2228. X    temp_pr = mem_create(wid,hgt,dep);
  2229. X    if (temp_pr== NULL)
  2230. X        {
  2231. X      printf("Not enough memory, memory allocation problems!!!\n");
  2232. X      exit(0);
  2233. X        }
  2234. X}
  2235. END_OF_touchup.c
  2236. if test 19131 -ne `wc -c <touchup.c`; then
  2237.     echo shar: \"touchup.c\" unpacked with wrong size!
  2238. fi
  2239. # end of overwriting check
  2240. fi
  2241. echo shar: End of archive 6 \(of 6\).
  2242. cp /dev/null ark6isdone
  2243. MISSING=""
  2244. for I in 1 2 3 4 5 6 ; do
  2245.     if test ! -f ark${I}isdone ; then
  2246.     MISSING="${MISSING} ${I}"
  2247.     fi
  2248. done
  2249. if test "${MISSING}" = "" ; then
  2250.     echo You have unpacked all 6 archives.
  2251.     rm -f ark[1-9]isdone
  2252. else
  2253.     echo You still need to unpack the following archives:
  2254.     echo "        " ${MISSING}
  2255. fi
  2256. ##  End of shell archive.
  2257. exit 0
  2258.